package com.backend.securitiessystem.controller;

import com.backend.securitiessystem.dto.FlashDto;
import com.backend.securitiessystem.pojo.Flash;
import com.backend.securitiessystem.result.Result;
import com.backend.securitiessystem.service.FlashService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 证券快讯 controller
 *
 * @author LWY
 * @date 2024-05-21 03:37:45
 */
@RestController
@Slf4j
public class FlashController {

    @Resource
    private FlashService iTbFlashService;


    @GetMapping("/getSecuritiesNewsByPage")
    public Result<IPage<FlashDto>> getNewShareByPage(
            @RequestParam(defaultValue = "2") Integer pageNum,
            @RequestParam(defaultValue = "2") Integer pageSize
    ) {

        QueryWrapper<Flash> queryWrapper=new QueryWrapper<>();

        IPage<FlashDto> indexDtoIPage= iTbFlashService
                .selectPageWithCondition(pageNum,pageSize,queryWrapper);

        log.info("获取证券快讯分页数据: {}", indexDtoIPage);
        return Result.success(indexDtoIPage);
    }
}
